package com.un.ebs.core.enums;


import lombok.Getter;
import org.jfree.data.general.Dataset;

import java.util.ArrayList;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;

/**
 * @Description 默认数据字段
 * @Author lcl
 * @Date Created in 2021/1/28
 */
@Getter
public enum DefaultFieldEnum {

    id(0, DataTypeEnum.STRING, "主键", "id", 40, 0),

    is_delete(1, DataTypeEnum.BOOLEAN, "是否删除", "is_delete", 2, 98),

    tenant_id(2, DataTypeEnum.STRING, "租户ID", "tenant_id", 40, 99),

    workflow_instance_id(3, DataTypeEnum.STRING, "工作流id", "workflow_instance_id", 40, 80),
    workflow_pass_status(3, DataTypeEnum.BOOLEAN, "工作流状态", "workflow_pass_status", 2, 81),

    idx_num(4, DataTypeEnum.INT, "排序编号", "idx_num", 3, 70),

    parent_id(5, DataTypeEnum.STRING, "节点id", "parent_id", 40, 71),

    submit_status(6, DataTypeEnum.BOOLEAN, "提交状态", "submit_status", 2, 60),
    submit_user_id(6, DataTypeEnum.STRING, "提交用户id", "submit_user_id", 40, 61),
    submit_personal_name(6, DataTypeEnum.STRING, "提交姓名", "submit_personal_name", 100, 62),
    submit_time(6, DataTypeEnum.DATETIME, "提交时间", "submit_time", 0, 63),
    audit_status(6, DataTypeEnum.BOOLEAN, "审核状态", "audit_status", 2, 64),
    audit_user_id(6, DataTypeEnum.STRING, "审核用户id", "audit_user_id", 40, 65),
    audit_personal_name(6, DataTypeEnum.STRING, "审核人姓名", "audit_personal_name", 100, 66),
    audit_time(6, DataTypeEnum.DATETIME, "审核时间", "audit_time", 0, 67),

    create_time(7, DataTypeEnum.DATETIME, "创建时间", "create_time", 0, 50),
    create_user_id(7, DataTypeEnum.STRING, "创建用户ID", "create_user_id", 40, 51),
    create_person_name(7, DataTypeEnum.STRING, "创建用户名称", "create_person_name", 100, 52),
    update_time(7, DataTypeEnum.DATETIME, "修改时间", "update_time", 0, 53),
    update_user_id(7, DataTypeEnum.STRING, "修改用户ID", "update_user_id", 40, 54),
    update_person_name(7, DataTypeEnum.STRING, "修改用户名称", "update_person_name", 100, 55);


    private final int parent;
    private final DataTypeEnum dataType;
    private final String desc;
    private final String value;
    private final int length;
    private final int indexNum;

    DefaultFieldEnum(int parent, DataTypeEnum dataType, String desc, String value, int length, int idx) {
        this.parent = parent;
        this.dataType = dataType;
        this.desc = desc;
        this.value = value;
        this.length = length;
        this.indexNum = idx;
    }

    public static List<DefaultFieldEnum> getByParent(int parent) {
        List<DefaultFieldEnum> list = new ArrayList<>();
        for (DefaultFieldEnum defaultFieldEnum : values()) {
            if (defaultFieldEnum.parent == parent) {
                list.add(defaultFieldEnum);
            }
        }
        return list;
    }
}
